<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>ec: ec::Timer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">ec
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>ec</b></li><li class="navelem"><a class="el" href="classec_1_1Timer.html">Timer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classec_1_1Timer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">ec::Timer Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>定时器类。  
 <a href="classec_1_1Timer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="timer_8h_source.html">timer.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:acbf2889a6472ca60ce4d3c8856b717c5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acbf2889a6472ca60ce4d3c8856b717c5"></a>
typedef std::function&lt; void()&gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classec_1_1Timer.html#acbf2889a6472ca60ce4d3c8856b717c5">Handler</a></td></tr>
<tr class="memdesc:acbf2889a6472ca60ce4d3c8856b717c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">定时器回调函数 <br/></td></tr>
<tr class="separator:acbf2889a6472ca60ce4d3c8856b717c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a85cc8b047f79f6017b865e3921eb0e95"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a85cc8b047f79f6017b865e3921eb0e95"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>Timer</b> (const <a class="el" href="classec_1_1Loop.html">ec::Loop</a> &amp;loop)</td></tr>
<tr class="separator:a85cc8b047f79f6017b865e3921eb0e95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad48f591873f207f843a3fc8b306063bf"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classec_1_1Timer.html#ad48f591873f207f843a3fc8b306063bf">startRounds</a> (uint32_t <a class="el" href="classec_1_1Timer.html#af632191a18c3b476fe052404643046c6">interval</a>, uint64_t <a class="el" href="classec_1_1Timer.html#ae576336f9adac852fcf1172e0c740960">round</a>, <a class="el" href="classec_1_1Timer.html#acbf2889a6472ca60ce4d3c8856b717c5">ec::Timer::Handler</a> handler)</td></tr>
<tr class="memdesc:ad48f591873f207f843a3fc8b306063bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">启动多轮循环定时器  <a href="#ad48f591873f207f843a3fc8b306063bf">More...</a><br/></td></tr>
<tr class="separator:ad48f591873f207f843a3fc8b306063bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af066807719d25dd78919346b1bc28d17"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classec_1_1Timer.html#af066807719d25dd78919346b1bc28d17">startOnce</a> (uint32_t <a class="el" href="classec_1_1Timer.html#af632191a18c3b476fe052404643046c6">interval</a>, <a class="el" href="classec_1_1Timer.html#acbf2889a6472ca60ce4d3c8856b717c5">ec::Timer::Handler</a> handler)</td></tr>
<tr class="memdesc:af066807719d25dd78919346b1bc28d17"><td class="mdescLeft">&#160;</td><td class="mdescRight">启动单次定时器  <a href="#af066807719d25dd78919346b1bc28d17">More...</a><br/></td></tr>
<tr class="separator:af066807719d25dd78919346b1bc28d17"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac103f227ad5f5bd44a29c24e37aabc20"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classec_1_1Timer.html#ac103f227ad5f5bd44a29c24e37aabc20">startForever</a> (uint32_t <a class="el" href="classec_1_1Timer.html#af632191a18c3b476fe052404643046c6">interval</a>, <a class="el" href="classec_1_1Timer.html#acbf2889a6472ca60ce4d3c8856b717c5">ec::Timer::Handler</a> handler)</td></tr>
<tr class="memdesc:ac103f227ad5f5bd44a29c24e37aabc20"><td class="mdescLeft">&#160;</td><td class="mdescRight">启动无限循环定时器  <a href="#ac103f227ad5f5bd44a29c24e37aabc20">More...</a><br/></td></tr>
<tr class="separator:ac103f227ad5f5bd44a29c24e37aabc20"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3bbcca634bad30417438a085abe31d25"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classec_1_1Timer.html#a3bbcca634bad30417438a085abe31d25">startAfter</a> (uint32_t after, uint32_t <a class="el" href="classec_1_1Timer.html#af632191a18c3b476fe052404643046c6">interval</a>, uint64_t <a class="el" href="classec_1_1Timer.html#ae576336f9adac852fcf1172e0c740960">round</a>, <a class="el" href="classec_1_1Timer.html#acbf2889a6472ca60ce4d3c8856b717c5">ec::Timer::Handler</a> handler)</td></tr>
<tr class="memdesc:a3bbcca634bad30417438a085abe31d25"><td class="mdescLeft">&#160;</td><td class="mdescRight">在指定事件后启动定时器  <a href="#a3bbcca634bad30417438a085abe31d25">More...</a><br/></td></tr>
<tr class="separator:a3bbcca634bad30417438a085abe31d25"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af632191a18c3b476fe052404643046c6"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classec_1_1Timer.html#af632191a18c3b476fe052404643046c6">interval</a> () const </td></tr>
<tr class="separator:af632191a18c3b476fe052404643046c6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae576336f9adac852fcf1172e0c740960"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classec_1_1Timer.html#ae576336f9adac852fcf1172e0c740960">round</a> () const </td></tr>
<tr class="separator:ae576336f9adac852fcf1172e0c740960"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a447daf396b3eade6cdea14912575525a"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classec_1_1Timer.html#a447daf396b3eade6cdea14912575525a">curRound</a> () const </td></tr>
<tr class="separator:a447daf396b3eade6cdea14912575525a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97095d71c497ae7e47b01bffb9383542"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classec_1_1Timer.html#a97095d71c497ae7e47b01bffb9383542">isFinished</a> () const </td></tr>
<tr class="separator:a97095d71c497ae7e47b01bffb9383542"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>定时器类。 </p>
<p>封装了libevent的定时器， </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a447daf396b3eade6cdea14912575525a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint64_t ec::Timer::curRound </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>获取当前周期 </p>

</div>
</div>
<a class="anchor" id="af632191a18c3b476fe052404643046c6"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t ec::Timer::interval </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>获取定时时长 </p>

</div>
</div>
<a class="anchor" id="a97095d71c497ae7e47b01bffb9383542"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool ec::Timer::isFinished </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>是否已经结束 </p>

</div>
</div>
<a class="anchor" id="ae576336f9adac852fcf1172e0c740960"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">uint64_t ec::Timer::round </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>获取总周期 </p>

</div>
</div>
<a class="anchor" id="a3bbcca634bad30417438a085abe31d25"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ec::Timer::startAfter </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>after</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>interval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64_t&#160;</td>
          <td class="paramname"><em>round</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classec_1_1Timer.html#acbf2889a6472ca60ce4d3c8856b717c5">ec::Timer::Handler</a>&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>在指定事件后启动定时器 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">after</td><td>在此时长后开始定时，以毫秒为单位 </td></tr>
    <tr><td class="paramname">interval</td><td>定时时长，以毫秒为单位 param round 总周期 </td></tr>
    <tr><td class="paramname">handler</td><td>定时回调函数 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ac103f227ad5f5bd44a29c24e37aabc20"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ec::Timer::startForever </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>interval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classec_1_1Timer.html#acbf2889a6472ca60ce4d3c8856b717c5">ec::Timer::Handler</a>&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>启动无限循环定时器 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">interval</td><td>定时时长，以毫秒为单位 </td></tr>
    <tr><td class="paramname">handler</td><td>定时回调函数 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="af066807719d25dd78919346b1bc28d17"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ec::Timer::startOnce </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>interval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classec_1_1Timer.html#acbf2889a6472ca60ce4d3c8856b717c5">ec::Timer::Handler</a>&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>启动单次定时器 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">interval</td><td>定时时长，以毫秒为单位 </td></tr>
    <tr><td class="paramname">handler</td><td>定时回调函数 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ad48f591873f207f843a3fc8b306063bf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ec::Timer::startRounds </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>interval</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64_t&#160;</td>
          <td class="paramname"><em>round</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classec_1_1Timer.html#acbf2889a6472ca60ce4d3c8856b717c5">ec::Timer::Handler</a>&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>启动多轮循环定时器 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">interval</td><td>定时时长，以毫秒为单位 </td></tr>
    <tr><td class="paramname">round</td><td>总周期 </td></tr>
    <tr><td class="paramname">handler</td><td>定时回调函数 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>include/ec/<a class="el" href="timer_8h_source.html">timer.h</a></li>
<li>src/timer.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Jul 12 2016 14:15:10 for ec by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
